package com.ruoyi.web.controller.basic;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BasicInStationMessage;
import com.ruoyi.system.service.IBasicInStationMessageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 站内消息Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/basicInStationMessage")
public class BasicInStationMessageController extends BaseController
{
    @Autowired
    private IBasicInStationMessageService basicInStationMessageService;

    /**
     * 查询站内消息列表
     */
    @PreAuthorize("@ss.hasPermi('system:basicInStationMessage:list')")
    @GetMapping("/list")
    public TableDataInfo list(BasicInStationMessage basicInStationMessage)
    {
        startPage();
        List<BasicInStationMessage> list = basicInStationMessageService.selectBasicInStationMessageList(basicInStationMessage);
        return getDataTable(list);
    }

    /**
     * 导出站内消息列表
     */
    @PreAuthorize("@ss.hasPermi('system:basicInStationMessage:export')")
    @Log(title = "站内消息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BasicInStationMessage basicInStationMessage)
    {
        List<BasicInStationMessage> list = basicInStationMessageService.selectBasicInStationMessageList(basicInStationMessage);
        ExcelUtil<BasicInStationMessage> util = new ExcelUtil<BasicInStationMessage>(BasicInStationMessage.class);
        util.exportExcel(response, list, "站内消息数据");
    }

    /**
     * 获取站内消息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:basicInStationMessage:query')")
    @GetMapping(value = "/{inStationMessageId}")
    public AjaxResult getInfo(@PathVariable("inStationMessageId") Long inStationMessageId)
    {
        return success(basicInStationMessageService.selectBasicInStationMessageByInStationMessageId(inStationMessageId));
    }

    /**
     * 新增站内消息
     */
    @PreAuthorize("@ss.hasPermi('system:basicInStationMessage:add')")
    @Log(title = "站内消息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BasicInStationMessage basicInStationMessage)
    {
        return toAjax(basicInStationMessageService.insertBasicInStationMessage(basicInStationMessage));
    }

    /**
     * 修改站内消息
     */
    @PreAuthorize("@ss.hasPermi('system:basicInStationMessage:edit')")
    @Log(title = "站内消息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BasicInStationMessage basicInStationMessage)
    {
        return toAjax(basicInStationMessageService.updateBasicInStationMessage(basicInStationMessage));
    }

    /**
     * 删除站内消息
     */
    @PreAuthorize("@ss.hasPermi('system:basicInStationMessage:remove')")
    @Log(title = "站内消息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{inStationMessageIds}")
    public AjaxResult remove(@PathVariable Long[] inStationMessageIds)
    {
        return toAjax(basicInStationMessageService.deleteBasicInStationMessageByInStationMessageIds(inStationMessageIds));
    }
}
